<el-dialog :close-on-click-modal="false"  :close-on-press-escape="false"  class="dialogStyleBase" :title="mixinEdit_editTitle" width="500px" :visible.sync="mixinEdit_editVisible"
    :before-close="function(){mixinEdit_editBoxClose('editForm')}" append-to-body>
    <div class="dialogStyleBaseBox" v-loading="mixinEdit_loading">

        <el-form ref="editForm" :model="form" label-width="100px"
        label-position="left" v-if="mixinEdit_editType=='add'">

        <el-form-item v-if="show === ''" label="手机号" prop="mobile" :rules="[{trigger: ['blur', 'change'] , required:true,validator: $vFN.Tools.validatePhone}]" >
            <el-input :disabled="show !== ''" v-model="form.mobile"  show-word-limit>
                <el-button v-if="show == ''" slot="append" icon="el-icon-search" @click="phoneInquiry('editForm')"></el-button>
            </el-input>
        </el-form-item>

        <el-form-item v-else label="手机号" >
            <el-input :disabled="show !== ''" v-model="form.mobile"  show-word-limit></el-input>
        </el-form-item>

        <!-- 查询没有 -->
        <div v-if="show === 0">

            <el-form-item label="姓名" prop="realName" :rules="{ required: true, message: '姓名 不能为空'}">
                <el-input :disabled="mixinEdit_editType=='update'" v-model="form.realName" maxlength="20" show-word-limit></el-input>
            </el-form-item>
            <el-form-item label="密码" prop="password"  :rules="[{trigger: ['blur', 'change'] , required:true,validator: $vFN.Tools.validatePassword}]">
                <el-input :disabled="mixinEdit_editType=='update'" show-password v-model="form.password" minlength="8" maxlength="20" show-word-limit></el-input>
            </el-form-item>
            <el-form-item label="选择角色" prop="roleId" :rules="{ required: true, message: '请选择角色',trigger: ['blur', 'change']}">
                <el-select v-model="form.roleName" placeholder="请选择" style="width:100%" @change="selectRole" >
                    <el-option v-for="item in listCanAuthRole"
                               :key="item.id"
                               :label="item.name"
                               :value="item.id">
                    </el-option>
                </el-select>
            </el-form-item>

            <el-form-item label="头像"  >
                <SelectImageRadio :appWindow="appWindow" v-model="form.icon" @change="validate"></SelectImageRadio>
            </el-form-item>
            
        </div>
        
        <!-- 查询有 -->
        <div v-if="show === 1">

            <el-form-item label="姓名">
                <el-input :disabled="mixinEdit_editType" v-model="showData.realName"  show-word-limit></el-input>
            </el-form-item>
            <el-form-item label="选择角色" prop="roleId" :rules="{ required: true, message: '请选择角色',trigger: ['blur', 'change']}" >
                <el-select v-model="form.roleName" placeholder="请选择" style="width:100%" @change="selectRole" >
                    <el-option v-for="item in listCanAuthRole"
                               :key="item.id"
                               :label="item.name"
                               :value="item.id">
                    </el-option>
                </el-select>
            </el-form-item>

        </div>

        </el-form>

        <el-form ref="editForm" :model="form" label-width="100px"
                 label-position="left" v-if="mixinEdit_editType=='update'">
        
            <el-form-item label="手机号" >
                <el-input :disabled="mixinEdit_editType=='update'" v-model="form.mobile" maxlength="20" show-word-limit></el-input>
            </el-form-item>
            <el-form-item label="姓名" >
                <el-input :disabled="mixinEdit_editType=='update'" v-model="form.realName" maxlength="20" show-word-limit></el-input>
            </el-form-item>
            <el-form-item label="选择角色" prop="roleId" :rules="{ required: true, message: '请选择角色',trigger: ['blur', 'change']}">
                <el-select v-model="form.roleName" placeholder="请选择" style="width:100%">
                    <el-option v-for="item in listCanAuthRole"
                               :key="item.id"
                               :label="item.name"
                               :value="item.id">
                    </el-option>
                </el-select>
            </el-form-item>

        </el-form>

    </div>
    <div slot="footer">
        <el-row>
            <el-col :span="12" style="text-align: left;" v-if="mixinEdit_editType!=='update'">
                <el-button  :disabled="mixinEdit_loading" @click="show = ''">重新搜索</el-button>
            </el-col>
            <el-col :span="mixinEdit_editType!=='update' ? 12 : ''">
                <el-button :disabled="mixinEdit_loading" @click="mixinEdit_editVisible = false">取 消</el-button>
                <el-button :disabled="mixinEdit_loading" type="primary" @click="mixinEdit_editFormSubmit({model:'form',ref:'editForm'})">确
                    定</el-button>
            </el-col>
        </el-row>
    </div>
</el-dialog>
